<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>3.遍历Map类型数据</title>
</head>

<body>
  <script>
    let hd = new Map([['hdcms', '开源系统'], ['houdunren', '开源教程']]);
    hd.set("namne", "在线教程");
    console.log(hd.keys());// 所有键 MapIterator {'hdcms', 'houdunren', 'namne'}
    console.log(hd.values());// 所有值 MapIterator {'开源系统', '开源教程', '在线教程'}
    console.log(hd.entries());//迭代器：  MapIterator {'hdcms' => '开源系统', 'houdunren' => '开源教程', 'namne' => '在线教程'}
    //遍历 
    for(const [key,value] of hd.entries()){
      console.log(key,value);
    }
    hd.forEach((value,key)=>{
      console.log(value,key);
    });
  </script>
</body>

</html>